<template>
  <div class="nav-bar">
    <toast ref="toast"/>
    <div></div>
    <div class="title">学生广场</div>
    <div >
      <img class="push" src="../../assets/img/square/添加 (1).svg" @click="to_push" alt="">
    </div>
  </div>
</template>

<script>
import Toast from '../../components/Toast/Toast.vue'

export default {
  components: { Toast },
  name: '',
  data () {
    return {
      
    }
  },
  computed:{
    isLogin(){
      return this.$store.getters.isLogin
    }
  },
  methods:{
    to_push(){
      if(!this.isLogin){
        let msg = '请先登录'
        let color = 'Orange'
        this.$refs.toast.show(msg,color)
        return 
      }
      this.$router.push("/square_post");
    }
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .nav-bar{
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    height: 44px;
    background-color: rgb(76, 76, 245);
    color: #fff;
    line-height: 44px;
    text-align: center;
    display: flex;
    z-index: 3;
  }
  .nav-bar div{
    flex: 1;
  }
  .push{
    margin-left: 40px;
    margin-top: 5px;
    width: 35px;
    height: 35px;
  }

</style>